<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('未出款数据')" />
</head>
<body class="gray-bg">
     <div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="formId">
					<div class="select-list">
						<ul>

							<li>
								<label style="width: 100px">服务商编号：</label>
								<input type="text" name="agent_num"/>
							</li>
							<li>
								<label style="width: 100px">服务商名称：</label>
								<input type="text" name="agent_name"/>
							</li>
							<li>
								<label style="width: 100px">出款流水号：</label>
								<input type="text" name="settle_serial"/>
							</li>
							<li>
								<label style="width: 100px">结算人：</label>
								<input type="text" name="screen_name"/>
							</li>

							<li class="select-time">
								<label style="width: 100px">日期：</label>
								<input type="text" class="time-input" readonly id="startTime" placeholder="开始时间" name="mindDate"/>
								<span>-</span>
								<input type="text" class="time-input" readonly id="endTime" placeholder="结束时间" name="maxDate"/>
							</li>
							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
							    <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>
			<div class="btn-group-sm" id="toolbar" role="group">
				<!--<a class="btn btn-success single disabled" onclick="changeAccounts()" shiro:hasPermission="agentInfo:profitSbOrder:changeAccounts">
					<i class="fa fa-edit"></i> 同步结算账户信息
				</a>-->
				<a class="btn btn-success multiple disabled" onclick="transFo()" shiro:hasPermission="agentInfo:profitSbOrder:transfo">
					<i class="fa fa-edit"></i> 一键转单
				</a>

			</div>
			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table"></table>
			</div>
		</div>
	</div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
        var prefix = ctx + "agentInfo/profitSbOrder";

		var terminalTypeDatas = [[${@dict.getType('terminal_type')}]];
		var profit_type_paid = [[${@dict.getType('profit_type_paid')}]];



		$(function()  {
            var options = {
                url: prefix + "/errorPayList",
		        showSearch: false,
		        showRefresh: false,
		        showToggle: false,
		        showColumns: false,
	            clickToSelect:true,
                columns: [{
		            checkbox: true
		        },
                {
                    field : 'SETTLE_SERIAL',
                    title : '流水号',
                    visible: false
                },
				{
					field : 'SETTLE_SERIAL',
					title : '流水号',
					width: "300",
					formatter:function (value, row, index) {
						return value+$.table.tooltip('[备注]'+row.NOTE,4);
					}
				},
				{
					field : 'ORDERNUMBER',
					title : '审核单号'
				},
				{
					field : 'AGENT_NUM',
					title : '服务商编号'
				},
				{
					field : 'AGENT_NAME',
					title : '服务商名称',
					formatter:function (value, row, index) {
						return $.table.tooltip(value,4);
					}
				},
				{
					field : 'AUDITDATE',
					title : '生成日期'
				},
				{
					field : 'PROFIT_TYPE',
					title : '类型',
					formatter:function(value,row,index){
						return $.table.selectDictLabel(profit_type_paid, value);
					}
				},
				{
					field : 'CYCLE',
					title : '周期',
					formatter: function(value, row, index) {
						if ("0"==value){
							return '<span style="color:blue;">日返</span>';
						}else if("1"==value){
							return '<span style="color:green;">月返</span>';
						}else{
							return '<span style="color:red;">未知</span>';
						}
					}
				},
				{
					field : 'SCREEN_NAME',
					title : '结算人'
				},
				{
					field : 'BANK_NAME',
					title : '开户行名称'
				},
				{
					field : 'SHOW_SCREENNUM',
					title : '结算卡'
				},
				{
					field : 'MONEY',
					title : '结算金额(元)',
					formatter: function(value, row, index) {
						return $.table.rmbFormatter(value);
					}
				},
				{
					field : 'PAY_TIME',
					title : '付款时间'
				},

				{
					field : 'STATUS',
					title : '出款状态',
					formatter: function(value, row, index) {
						if ("0"==value){
							return '<span style="color:blue;">待处理</span>';
						}else if("1"==value){
							return '<span style="color:green;">出款成功</span>';
						}else if("-2"==value){
							return '<span style="color:#880000;">出款失败</span>';
						}else if("-3"==value){
							return '<span style="color:green;">冻结</span> ';
						}else if("-1"==value){
							return '<span style="color:green;">已上送</span>';
						}else{
							return '<span style="color:red;">出款失败</span>';
						}
					}
				},]
            };
            $.table.init(options);
        });

		function transFo() {
            table.set();
            var rows = $.common.isEmpty(table.options.uniqueId) ? $.table.selectFirstColumns() : $.table.selectColumns(table.options.uniqueId);
            if (rows.length == 0) {
                $.modal.alertWarning("请至少选择一条记录");
                return;
            }

			$.modal.open("一键转单",prefix + "/transFo?ids="+ rows.join(),'800');
		}

        function changeAccounts() {
			table.set();
			var settleSerial = $.table.selectColumns("SETTLE_SERIAL");
			if ($.common.isEmpty(settleSerial)) {
				$.modal.alertWarning("请至少选择一条记录");
				return;
			}
			$.modal.open("同步结算账户信息",prefix + "/changeAccounts/" + settleSerial,'800');
		}
    </script>
</body>
</html>